package info.ask4research.service.impl;

import info.ask4research.dao.core.AbstractDao;
import info.ask4research.dao.impl.AddonDAO;
import info.ask4research.model.addons.Addon;
import info.ask4research.model.addons.MultipleChoice;
import info.ask4research.model.addons.QuestionsAndAnswers;
import info.ask4research.model.addons.TextWork;
import info.ask4research.model.addons.UploadingFiles;
import info.ask4research.service.IAddonService;
import info.ask4research.service.core.impl.AbstractServiceImpl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service(value="addonService")
@Transactional
public class AddonService extends AbstractServiceImpl<Addon> implements IAddonService{

	
	@Resource(name = "addonDAO")
	AddonDAO dao;

	@Override
	public AbstractDao<Addon> getDao() {
		return dao;
	}

	@Override
	public void setDao(AbstractDao<Addon> dao) {
		this.dao = (AddonDAO) dao;
	}
	
	@Override
	public boolean textWorkExists(String text, Integer unitOfLearningId) {
		return dao.textWorkExists(text, unitOfLearningId);
	}
	
	@Override
	public List<TextWork> getTextWorkAddonByUoL(int id) {
		return dao.getTextWorkAddonByUoL(id);
	}
	
	@Override
	public List<UploadingFiles> getUploadingFilesAddonByUoL(int id) {
		return dao.getUploadingFilesAddonByUoL(id);
	}

	@Override
	public List<QuestionsAndAnswers> getQuestionsAnswersAddonByUoL(int id) {
		return dao.getQuestionsAnswersAddonByUoL(id);
	}

	@Override
	public List<MultipleChoice> getMcTestAddonByUoL(int id) {
		return dao.getMcTestAddonByUoL(id);
	}
	
	@Override
	public boolean uploadingFilesExists(String text, Integer UnitOfLearningId) {
		return dao.uploadingFilesExists(text, UnitOfLearningId);
	}
	
	@Override
	public boolean qnrExists(String text, Integer UnitOfLearningId) {
		return dao.qnrExists(text, UnitOfLearningId);
	}
	
	@Override
	public QuestionsAndAnswers getQuestionsAndAnswersById(Integer qnrId) {
		return (QuestionsAndAnswers) dao.get(qnrId);
	}
	
	@Override
	public boolean mctExists(String text, Integer attribute) {
		return dao.mctExists(text, attribute);
	}
	
	@Override
	public boolean addonNameExists(String stringAddon, Integer UoLId) {
		return dao.addonNameExists(stringAddon, UoLId);
	}
	
	@Override
	public Addon getAddonByUoFandRoleName(String stringAddon, Integer UoLId) {
		return dao.getAddonByUoFandRoleName(stringAddon, UoLId);
	}
	
	@Override
	public MultipleChoice getMultipleChoiceById(Integer mctId) {
		return (MultipleChoice) dao.get(mctId);
	}

	@Override
	public List<Addon> getAddonsByUoL(int id) {
		return dao.getAddonsByUoL(id);
	}


}
